package stream;

import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.function.BinaryOperator;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class StreamApp {
    public static void main(String[] args) {
        Stream<Integer> s1 = Stream.of(1, 2, 3);
        Stream<Integer> s2 = Arrays.stream(new Integer[]{1, 2, 3});
        Stream<Integer> s3 = List.of(1, 2, 3).stream();
        Stream<String> s4 = Set.of("abc", "cd", "ef").stream();
        Stream<Integer> s5 = Stream.generate(() -> new Random().nextInt());
        Stream<Integer> s6 = Stream.generate(() -> new Random().nextInt());

        s5.forEach(item->{
            System.out.println(item+"....."+Thread.currentThread().getName());
        });

    }
}
